Skip to main content

reshape

reshape(matrix: any[] | Mat | Tensor, sizes: any[]) : any[] | Mat | Tensor

param matrix - an Array, Mat or Tensor - the construct to reshape according to sizes.

param sizes a 1-D Array (list) representing the size - dimension-wise.

returns - any[] | Mat | Tensor - an Array, Mat or Tensor reshaped with the corresponding size given in sizes

size should be something like [2, 2, 2] or [2, -1]. In the latter case, -1 means automatically matching.